package com.py.custom.business.demo.core.controller;

import com.py.custom.business.demo.core.service.MessageReachService;
import com.py.custom.business.demo.protocol.request.MessageRequest;
import com.py.custom.common.web.response.BaseResponse;
import com.py.custom.common.web.utils.ResponseUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * description： 消息发送接口
 */
@RestController
@RequestMapping("/messageReach")
public class MessageReachController {

    @Resource
    private MessageReachService messageReachService;

    @PostMapping("/send")
    public BaseResponse<Boolean> send(@Validated
                                      @RequestBody MessageRequest request) {
        Boolean hasSuccess = messageReachService.send(request);
        return ResponseUtils.success(hasSuccess);
    }
}
